package database

import (
	"Software/global"
	"fmt"
	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
)

func InitMinioClient() {
	var err error
	minioEndpoint := global.Config.GetString("minio.minioEndpoint")
	accessKey := global.Config.GetString("minio.accessKey")
	secretKey := global.Config.GetString("minio.secretKey")
	minioOpt := &minio.Options{
		Creds: credentials.NewStaticV4(accessKey, secretKey, ""),
	}
	mc, err := minio.New(minioEndpoint, minioOpt)
	if err != nil {
		fmt.Println("err:", err)
		return
	}
	global.MC = mc
}
